package com.tjmc.nsia.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tjmc.nsia.core.dao.entity.NsiaOperLog;
import com.tjmc.nsia.core.dao.mapper.NsiaOperLogMapper;
import com.tjmc.nsia.core.service.NsiaOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 操作日志记录 服务实现类
 * </p>
 *
 * @author Luc
 * @since 2024/06/12
 */
@Service
public class NsiaOperLogServiceImpl extends ServiceImpl<NsiaOperLogMapper, NsiaOperLog> implements NsiaOperLogService {

    @Autowired
    private NsiaOperLogMapper nsiaOperLogMapper;

    @Override
    public NsiaOperLog getByRemark(String remark) {
        if(StringUtils.hasText(remark)) {
            return nsiaOperLogMapper.selectOne(new QueryWrapper<NsiaOperLog>().like("json_result", remark).last("limit 1"));
        }
        return null;
    }
}
